from selenium import webdriver
import requests
from time import sleep
wd=webdriver.Chrome()
# wd.set_window_size(1000,800)
wd.get('https://weibo.com/')
wd.maximize_window()
wd.implicitly_wait(60)
sleep(10)
wd.find_element_by_id('loginname').send_keys('18874028147')
wd.find_element_by_xpath('//div[@class="info_list password"]/div/input').send_keys('123456')
wd.find_element_by_xpath('//div[@class="info_list login_btn"]/a').click()
img_url='https://login.sina.com.cn/cgi/pin.php?r=61076560&s=0&p=tc-853be09b4c457d278ac60a5302efc09f7882'
headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'
    }
response=requests.get(img_url,headers=headers)
img_data=response.content
# with open('验证码.jpg','wb') as f:
#     f.write(img_data)
sleep(15)
wd.implicitly_wait(60)
wd.find_element_by_xpath('//div[@class="info_list login_btn"]/a').click()